#ifndef GRAMMAR_H
#define GRAMMAR_H

#include <vector>
#include <list>
#include <set>
#include "rule.h"

using namespace std;

class grammar {
  friend class parser;
  
 protected:
  set<string> Terminals;
  set<string> NonTerminals;
  RULESET Rules;
  string Initial;
  
 public:
  grammar ()
    {
    }
  grammar (set<string> t, set<string> n, RULESET r, string i)
    {
      Terminals=t;
      NonTerminals=n;
      Rules=r;
      Initial=i;
    }
  ~grammar ()
    {
    }
  void addRule(string, vector<string>, class features *);
  void addNonTerminal(string);
  void addTerminal(string);
  void print(ostream&);
  string getInitial() {return Initial;};
  void setInitial(string i) {Initial=i;};
  int isTerminate(string);
  int isNonTerminate(string);
  rule *addNewInitial(string l);
  void findTerms();
};

#endif // GRAMMAR_H
